Skip to content

fix(update): delete bun lockfile before install - #591

Merged
namastex888 merged 2 commits into
devfrom
fix/bun-lockfile
Mar 16, 2026
Merged

namastex888 merged 2 commits into
devfrom
fix/bun-lockfile

Conversation

@namastex888

Copy link
Copy Markdown
Contributor

bun's global lockfile pins old versions even with --force --no-cache. Delete it before installing.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue affecting the reliability of Bun package updates. It introduces a preventative measure to ensure that the bun add -g command correctly fetches and installs the latest package versions by explicitly removing Bun's global lockfile prior to execution. This change prevents the lockfile from pinning older versions, thereby improving the consistency and success rate of updates.

Highlights

  • Bun Update Reliability: Implemented a pre-installation step to delete Bun's global lockfile, resolving an issue where outdated package versions were retained despite using --force --no-cache flags during updates.
Changelog
  • src/genie-commands/update.ts
    • Added a step to delete the global Bun lockfile before initiating a Bun update to prevent old versions from being pinned.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@coderabbitai

coderabbitai Bot commented Mar 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9339191e-6c7c-4417-bd5d-53facfe91bfb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/bun-lockfile
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue with bun's global lockfile not being updated by deleting it before installation. The approach is valid. My review includes a suggestion to improve the implementation by using asynchronous file operations and avoiding an inline require, which aligns better with the existing code style in the file.

Comment thread src/genie-commands/update.ts Outdated

async function updateViaBun(channel: string): Promise<void> {
// Delete global lockfile — it pins old versions even with --force --no-cache
try { require("node:fs").unlinkSync(join(homedir(), ".bun", "install", "global", "bun.lock")); } catch { /* may not exist */ }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this works, it's better to avoid inline require statements and use the imports already available at the top of the file. Since updateViaBun is an async function, you should use the asynchronous unlink from node:fs/promises instead of unlinkSync to avoid blocking the event loop. The unlink function is already imported in this file.

Suggested change
try { require("node:fs").unlinkSync(join(homedir(), ".bun", "install", "global", "bun.lock")); } catch { /* may not exist */ }
try { await unlink(join(homedir(), ".bun", "install", "global", "bun.lock")); } catch { /* may not exist */ }

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59a6607560

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/genie-commands/update.ts Outdated

async function updateViaBun(channel: string): Promise<void> {
// Delete global lockfile — it pins old versions even with --force --no-cache
try { require("node:fs").unlinkSync(join(homedir(), ".bun", "install", "global", "bun.lock")); } catch { /* may not exist */ }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve bun lockfile path from BUN_INSTALL

This unlink targets only ~/.bun/install/global/bun.lock, but bun add -g uses the active environment and supports a custom global root via BUN_INSTALL; since runCommand forwards process.env, users with BUN_INSTALL set will keep using the lockfile in that alternate path, so the stale-version issue this change is trying to fix still reproduces for those installations.

Useful? React with 👍 / 👎.

@namastex888
namastex888 merged commit 6a68218 into dev Mar 16, 2026
5 checks passed
@namastex888
namastex888 deleted the fix/bun-lockfile branch March 29, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant